SftTree/OCX 7.0

Upgrading To Version 7.0 From Version 4.5

Softel vdm, Inc.

Converting an Existing Application

If you are upgrading from version 6.5, please see "Upgrading To Version 7.0" instead.

SftTree/OCX 7.0 is virtually 100% source compatible from older releases of SftTree/OCX. Your application(s) must be recompiled to use SftTree/OCX 7.0. SftTree/OCX 7.0 and older versions of SftTree/OCX can coexist on the same system and can be used in the same application.

SftTree/OCX 5.0 and newer introduce many new objects, which can be used to simplify use of the control by using object oriented programming (see "Converting To Version 7.0").

The conversion is not automatic.

Make sure to back up your current projects, before converting your projects.  Please read the conversion process specific to your language carefully BEFORE converting your project.

After converting, once the control saves updated property settings, you will not be able to return to SftTree/OCX 4.5.

As a project is upgraded, the following properties are not converted:

BackgroundX is set to 0
BackgroundY is set to 0

Visual Basic

After installing SftTree/OCX 7.0, all your projects will continue to use SftTree/OCX 4.5 until you make the following change in each project's main VBP (Visual Basic Project) file.  Before opening the project file, make sure to close the project in Visual Basic, then edit the VBP file using a text editor and make the following changes:

Existing Project File (VPB File):

Type=Exe
Form=Form1.frm
Reference=*\G{00020430-0000-0000-C000-000000000046}#2.0#0#G:\WINNT\System32\stdole2.tlb#OLE Automation
Object={216E1DBB-67F8-47F1-BB9D-FB311AD57EA3}#4.5#0; SftTree_IX86_A_45.ocx
IconForm="Form1"
Startup="Form1"
ExeName32="yourexe.exe"
Command32=""
Name="yourproject"

The line describing SftTree/OCX 4.5 (above, using a bold font) should be replaced with the following line:

Object={10C7FF30-FC3E-4579-A9F2-C1BA410D3B56}#7.0#0; SftTree_IX86_U_70.ocx

You can copy this line directly from this help file or copy it from the file "Upgrade.txt" which you can find in the SftTree/OCX product directory.  The line must be copied as-is, without any modifications.

Existing Forms And Modules (FRM, BAS Files):

All forms and modules must be edited using a text editor.  The following changes can easily be accomplished by a global edit and replace operation:

All references to SftTree.SftTree must be replaced by SftTreeLib70.SftTree.  

All references to SftTree.DataObject must be replaced by SftTreeLib70.DataObject.  

Once the VBP and FRM file have been saved, you can open the project in Visual Basic. Make sure to review each form (in design mode) and save it to complete the upgrade. The controls will save updated property settings, so you will not be able to return to SftTree/OCX 4.5. Once all forms have been saved, the project is using SftTree/OCX 7.0.

.NET (Managed Languages)

While most other languages offer a fairly easy conversion, .NET and its languages require a bit more effort, but in most cases is limited to the steps documented below.

Certain event parameter names have been changed to make parameter naming more consistent.  This requires modification of your source code to reflect the new parameter names.  This is addressed in the step-by-step instructions below.

All Picture and Font related properties now use a different type (IFontDisp instead of stdole.SftPicture).  Any Font and Picture related properties must now use the new syntax.  This is addressed in the step-by-step instructions below.

Existing Forms (FRM Files):

Updating the forms to use SftTree/OCX 7.0 is quite straightforward:

The forms can now be opened and the project uses SftTree/OCX 7.0 exclusively.  You will not be able to return to SftTree/OCX 4.5.

Visual C++ (Unmanaged C/C++)

Resource Files

After installing SftTree/OCX 7.0, all your projects will continue to use SftTree/OCX 4.5 until you make the following change in each dialog resource that defines a SftTree/OCX control.  Before opening the resource script (RC file), make sure to close the project in Visual C++, then edit the RC file using a text editor and make the following changes:

IDD_MFC_DIALOG DIALOGEX 0, 0, 320, 200
STYLE DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
EXSTYLE WS_EX_APPWINDOW
CAPTION "MFC"
FONT 8, "MS Sans Serif"
BEGIN
    DEFPUSHBUTTON   "OK",IDOK,260,7,50,14
    PUSHBUTTON      "Cancel",IDCANCEL,260,23,50,14
    CONTROL         "",IDC_TREECTRL1,"{216E1DBC-67F8-47F1-BB9D-FB311AD57EA3}",
                    WS_TABSTOP,1,2,242,196
END

The contents of the line describing SftTree/OCX 4.5 (above, using a bold font) should be replaced with the following:

    CONTROL         "",IDC_TREECTRL1,"{10C7FF33-FC3E-4579-A9F2-C1BA410D3B56}",

Only change the ClassID (i.e., {216E1DBC-67F8-47F1-BB9D-FB311AD57EA3}), do not change the rest of the line.

You can copy this information directly from this help file or copy it from the file "Upgrade.txt" which you can find in the SftTree/OCX product directory.  The ClassID must be copied as-is, without any modifications.

Once the RC file has been saved, you can open the project in Visual C++ and the project is now using SftTree/OCX 7.0.  The controls will save updated property settings, so you will not be able to return to SftTree/OCX 4.5.

Make sure to change ALL occurrences of SftTree/OCX to version 7.0, otherwise you will not be able to open the resource script (RC file).

#import Statements

The #import statement used with SftTree/OCX 4.5 must be replaced with an #import statement for the new version:

Version 4.5:

#pragma warning(disable : 4192)   // automatically excluding 'Ixxx' while importing type library 'stdole2.tlb'
// For information about the following construct, please see Microsoft's
// KnowledgeBase entry Q224610
#import <stdole2.tlb> rename_namespace("SftTreeNameSpace") exclude("GUID", "DISPPARAMS", "EXCEPINFO", \
	"OLE_XPOS_PIXELS", "OLE_YPOS_PIXELS", "OLE_XSIZE_PIXELS", "OLE_YSIZE_PIXELS", "OLE_XPOS_HIMETRIC", \
	"OLE_YPOS_HIMETRIC", "OLE_XSIZE_HIMETRIC", "OLE_YSIZE_HIMETRIC", "OLE_XPOS_CONTAINER", \
	"OLE_YPOS_CONTAINER", "OLE_XSIZE_CONTAINER", "OLE_YSIZE_CONTAINER", "OLE_HANDLE", "OLE_OPTEXCLUSIVE", \
	"OLE_TRISTATE", "OLE_CANCELBOOL", "OLE_ENABLEDEFAULTBOOL", "FONTSIZE", "OLE_COLOR")
#import <SftTree_IX86_A_45.OCX> rename_namespace("SftTreeNameSpace")
#pragma warning(default : 4192)

using namespace SftTreeNameSpace;

New for SftTree/OCX 7.0:

#pragma warning(disable : 4192)   // automatically excluding 'Ixxx' while importing type library 'stdole2.tlb'
// For information about the following construct, please see Microsoft's
// KnowledgeBase entry Q224610
#import <stdole2.tlb> rename_namespace("SftTreeNameSpace") exclude("OLE_HANDLE", \
    "OLE_COLOR", "IFontDisp", "IPictureDisp", "FONTSIZE")
#import <SftTree_IX86_U_70.OCX> rename_namespace("SftTreeNameSpace") rename("LoadImage", "LoadImageSftTree") \
    exclude("LONG_PTR")
#if _MSC_VER >= 1400 // need at least Visual Studio 2005
# pragma comment(lib, "comsuppw.lib") // avoid link error in VS2005
#endif
#pragma warning(default : 4192)

using namespace SftTreeNameSpace; 

Syntax Changes

The class wrapper for the control, generated by the above #import statement now generates incompatible properties for Picture and Font related properties.  Any Font and Picture related properties must now use the new syntax.

For example, the Font property could be accessed as follows:

FontPtr pFont = vTree->Font;
FontPtr pFont = vTree->GetFont();

Starting with 5.0, only the Get, Put functions can be used, as in:

FontPtr pFont = vTree->GetFont();

For details regarding the syntax of all Picture and Font properties, please see the respective property's documentation.

HTML

The conversion is not automatic.

After installing SftTree/OCX 7.0, all your HTML pages will continue to use SftTree/OCX 4.5 until you make the following change in each page that uses a SftTree/OCX control.

<OBJECT ID="Tree1" WIDTH=708 HEIGHT=203
 CLASSID="CLSID:A8BA388A-3246-4a2f-869C-CE7BDF6D9A24"
 CODEBASE="sfttreex.cab#version=4,5,0,500">
    <PARAM NAME="_Version" VALUE="262144">
    <PARAM NAME="_ExtentX" VALUE="14993">

The contents of the line describing SftTree/OCX 4.5 (above, using a bold font) should be replaced with the following:

 CLASSID="CLSID:0DE0AC03-8141-4ea3-8FDF-4960C261F680"

Only change the ClassID (i.e., "A8BA388A-3246-4a2f-869C-CE7BDF6D9A24"), do not change the rest of the line.

The CODEBASE argument also needs to be updated to reflect the new cabinet name and the current version number.

You can copy this information directly from this help file or copy it from the file "Upgrade.txt" which you can find in the SftTree/OCX product directory. The ClassID must be copied as-is, without any modifications.

Once the page has been saved, you can open the web page using your preferred HTML editor.  The controls will save updated property settings, so you will not be able to return to SftTree/OCX 4.5.

Other Development Tools

Most development tools allow access to the ClassID used for controls on a form or dialog.  Sometimes this may be accomplished by using a text editor and editing a configuration file, or possibly the development tool allows direct modification of the ClassID.

Generally, the ClassID used for the prior release {216E1DBB-67F8-47F1-BB9D-FB311AD57EA3} must be replaced with the new ClassID {10C7FF33-FC3E-4579-A9F2-C1BA410D3B56}. Once this step is completed, opening the project is sufficient to allow SftTree/OCX to convert the stored property settings.

For specific instructions or help, please see your development tool's documentation.


Feedback / comments / error reports for this topic
© 2015 - Softel vdm, Inc. - www.softelvdm.com